package $NAMESPACE.domain.configuration;

import com.ugeez.commons.account.configuration.EnableAccount;
import com.ugeez.commons.redis.utils.RedisOperateService;
import com.ugeez.commons.security.service.UserSecurityService;
import com.ugeez.commons.security.service.UserSecurityServiceBuilder;
import com.ugeez.commons.security.storage.RedisSessionStorage;
import com.ugeez.commons.security.storage.SessionStorage;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@EnableAccount
@MapperScan(basePackages = {"$NAMESPACE.persistence.dao"})
@ComponentScan(basePackages = {
        "$NAMESPACE.domain.service"
})
@Configuration
@Import({ UserSecuritySessionProperties.class })
public class $PROJ_NAMEDomainConfiguration {

	@Bean
    public UserSecurityService userUserSecurityService(RedisOperateService redisOperateService, 
													   UserSecuritySessionProperties userSecuritySessionProperties) {
        SessionStorage sessionStorage = new RedisSessionStorage(redisOperateService);
        UserSecurityService userSecurityService = UserSecurityServiceBuilder.build(sessionStorage, userSecuritySessionProperties);
        return userSecurityService;
    }

}
